<template>
  <div class="subheadings">
    {{ props.name }}
    <!--<el-button type="primary" link @click="reset"> 重置 </el-button>-->
  </div>
  <div class="assy">
    <el-form>
      <el-form-item label="工程类型：">
        <el-radio-group v-model="params.type" @change="getResult" class="radio1">
          <el-radio v-for="(item, index) in projectTypeOptions" :key="index" :label="item.value">
            {{ item.name }}
          </el-radio>
        </el-radio-group>
      </el-form-item>
      <el-form-item label="工程类别：">
        <el-radio-group v-model="params.category" @change="getResult" class="radio2">
          <el-radio v-for="(item, index) in categoryOptions" :key="index" :label="item.value">
            {{ item.name }}
          </el-radio>
        </el-radio-group>
      </el-form-item>     
    </el-form>
  </div>
</template>
<script setup>
const emit = defineEmits(['searchFn']);
import { ref, reactive, defineProps } from 'vue';
const props = defineProps({
  name: String,
});
const data = reactive({
  params: {
    type: 3, //工程类型
    category: 1, //工程类别
  },
  oriParams: {},
});
const { params, oriParams } = toRefs(data);
oriParams.value = JSON.parse(JSON.stringify(params.value));

const projectTypeOptions = [
  { name: '全部', value: 1 },
  { name: '新建工程', value: 2 },
  { name: '加固工程', value: 3 },
];
const categoryOptions = [
  { name: '全部', value: 1 },
  { name: '大中小学校', value: 2 },
  { name: '城镇住宅', value: 3 },
  { name: '医院', value: 4 },
  { name: '危险化学品厂', value: 5 },
  { name: '电信网络', value: 6 },
  { name: '电力网络', value: 7 },
  { name: '农村居民', value: 8 },
  { name: '重要交通生命线', value: 9 },
  { name: '应急避难场所', value: 10 },
  { name: '水库大坝', value: 11 },
  { name: '其他', value: 12 },
];

getResult();

function getResult() {
  // 查询时,需要格式化一下震级
  emit('searchFn', params.value);
}

function reset() {
  params.value = JSON.parse(JSON.stringify(oriParams.value));
  getResult();
}
</script>
<style lang="scss" scoped>
.subheadings {
  width: 450px;
  height: 105px;
  background-size: 100% 100%;
  background-image: url(/src/assets/images/common/bg_little_title.png);
  margin: 0 auto;
  color: #e4f5ff;
  font-size: 22px;
  font-family: Source Han Sans;
  font-weight: 500;
  line-height: 80px;
  text-align: left;
  box-sizing: border-box;
  padding-left: 40px;
  .el-button--primary {
    background: transparent !important;
    border: none !important;
    float: right;
    margin-top: 26px;
    color: #46ffff !important;
    font-size: 14px;
    cursor: pointer;
  }
}
.assy {
  color: #fff;
  padding: 0 20px;
  margin: 15px auto 0;
  label {
    font-weight: 400;
  }
  .el-form-item {
    display: block;
    font-size: 18px;
    position: relative;
    padding-left: 8px;
    margin-bottom: 5px;
    /*&::before {
      content: '';
      display: block;
      width: 3px;
      height: 15px;
      background: #fff;
      position: absolute;
      top: 8px;
      left: 0;
    }*/
    :deep(.el-form-item__label) {
      display: block;
      color: #fff;
      font-size: 18px;
      font-weight: 400;
      text-align: left;
    }
    &:last-child {
      &::before {
        display: none;
      }
    }
    .el-radio {
      margin: 5px 0;
      padding-left: 12px;
      color: #fff;
      font-size: 18px;
    }
    .radio1 {
      display: flex;
      width: 100%;
      .el-radio {
        width: calc(100% / 3);
      }
    }
    .radio2 {
      display: flex;
      flex-wrap: wrap;
      .el-radio {
        width: 50%;
        margin: 5px 0;
      }
    }
  }

  :deep(.el-slider) {
    width: 370px;
    margin: 24px auto 10px;
    .el-slider__runway {
      height: 20px;
      // background: linear-gradient(#1D388F 0%, #0B1864 53%, #1D388F 100%);
      background: #000535;
      border-radius: 0;
      opacity: 1;
      border: 1px solid #46ffff;

      .el-slider__bar {
        margin: 0 10px 0 3px;
        top: 5px;
        height: 10px;
        background: url('@/assets/images/intensity/slider-bar.png') repeat-x;
      }

      .el-slider__button-wrapper {
        top: 0;
        height: 100%;

        .el-slider__button {
          margin-top: -7px;
          margin-left: 8px;
          width: 17px;
          height: 34px;
          background: url('@/assets/images/disaterLosses/slider-arrow.png') no-repeat center;
          background-size: 100% 100%;
          border: none;
          border-radius: 0;
          margin-bottom: -2px;
        }
      }
    }

    .el-slider__marks {
      .el-slider__marks-text {
        margin-top: -28px;
        color: #dffaff;
        font-size: 18px;
      }
    }

    .el-slider__stop {
      display: none;
    }
  }

  .num {
    display: flex;
    margin-left: -10px;
    :deep(.el-input-number) {
      width: 150px;
      height: 30px;
      background: rgba(255, 255, 255, 0.15);
      box-sizing: border-box;
      margin: 0 10px;
      overflow: hidden;
      .el-input__inner {
        width: 100%;
        height: 29px;
        background: transparent;
        padding-left: 10px;
        color: #fff;
        text-align: left;
        border: none !important;
      }
      /* input 类型为 number 时去掉数字加减上下箭头 */
      input::-webkit-outer-spin-button,
      input::-webkit-inner-spin-button {
        -webkit-appearance: none !important;
      }
    }
  }
}
// 单选框样式
:deep(.el-radio:hover .el-radio__inner){
  border-color: #46FFFF;
}
:deep(.el-radio__inner){
  width: 20px;
  height: 20px;
  background: rgba(255,255,255,0.5);
  border: 2px solid #FFFFFF;
  box-sizing: border-box;
}
:deep(.el-radio__label){
  font-size: 18px;
}
//按钮内图案样式
:deep(.el-radio__inner::after) {
  width: 9px;
  height: 9px;
  background-color: #46FFFF;
}
:deep(.el-radio__input.is-checked .el-radio__inner){
  border-color: #46FFFF;
  background: transparent;
  border: 2px solid #46FFFF;
}
:deep(.el-radio__input.is-checked+.el-radio__label) {
  color: #46FFFF;
}
</style>
